package com.rz.spark.utils

object RptUtil {
  /**
    *List(原始请求,有效请求，广告请求)
    */
  def calculateReq(reqMode: Int, prcNode:Int):List[Double] ={
    // 是不是原始请求,有效请求，广告请求
    if (reqMode ==1 && prcNode== 1) {
      List[Double](1,0,0)
    } else if (reqMode ==1 && prcNode== 1) {
      List[Double](1,1,0)
    } else if (reqMode ==1 && prcNode== 1) {
      List[Double](1,1,1)
    } else List[Double](0,0,0)
  }

  /**
    * List(参与竞价，竞价成功,消费，成本)
    */
  def calculateRtb(effective:Int, bill:Int, bid:Int, orderid:Int, win:Int, winPrice:Double, adPayment:Double):List[Double]={
    // 参与竞价,竞价成功 List(参与竞价，竞价成功,消费，成本)

    if (effective ==1 && bill ==1 && bid==1 && orderid !=0) {
      List[Double](1,0,0,0)
    } else  if (effective ==1 && bill ==1 && win==1 ){
      List[Double](0,1,winPrice/1000.0,adPayment/1000.0)
    }else List[Double](0,0,0,0)
  }

  /**
    *
    * List(展示，点击)
    */
  def calculateShowClick(reqMode: Int, effective:Int):List[Double]={
    // 广告展示
    if (reqMode ==2 && effective ==1) {
      List[Double](1,0)
    } else if (reqMode ==3 && effective ==1) {
      List[Double](0,1)
    } else List[Double](0,0)
  }
}
